#pragma once

#define STRING_INCRE_LEN 20

#include <iostream>

using namespace std;




class EString
{
public:
	
	EString(const char *);
	EString(int);
	EString(EString &);
	EString& operator=(EString&);
	const char operator[](int);
	EString operator+(EString&);
	EString& operator+=(EString&);
	~EString(void);
	const char * c_str();

	friend ostream& operator <<(ostream& , EString &);

private:
	void InitEString(int len);
	int getCapacityByLen(int len)
	{	return ((len / STRING_INCRE_LEN) + 1) * STRING_INCRE_LEN; };

private:
	char *buffer;
	int len;
	int capacity;
};

ostream& operator <<(ostream& , EString &);